﻿Imports System.IO

Public Class CreateNewPolicyForm
    Dim Repository As String = Main.Repository

    Private Sub NewPolicyForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.Text = "Create New Policy (" & Repository & ")"

        'Main.MainListBox.SelectedItem(
    End Sub

    Private Sub CreateNewPolicyOKButton_Click(sender As System.Object, e As System.EventArgs) Handles CreateNewPolicyOKButton.Click
        If Len(Trim(PolicyFileName.Text)) > 0 And Len(Trim(PolicyName.Text)) > 0 Then
            Dim InvalidCharString As String = ""
            For Each InvalidChar As Char In Path.GetInvalidFileNameChars()
                InvalidCharString = Trim(InvalidCharString & "      " & InvalidChar)
            Next
            Dim InvalidCharStrings As String() = Split(InvalidCharString, "      ")

            For Each InvalidChar As String In InvalidCharStrings
                If InStr(PolicyFileName.Text, InvalidChar) > 0 Then
                    MsgBox("The PolicyFilename contains an invalid character """ & InvalidChar & """", MsgBoxStyle.Critical, "PassFiltAdmin")
                    Exit For
                End If

            Next


        End If
    End Sub
End Class